<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <title>系统登录</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script type="text/javascript"  src="http://www.ijquery.cn/js/html5shiv.js"></script>
<![endif]-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/jquery-1.12.4.min.js">\x3C/script>')</script>
<!--也可以用yepnopejs 加载器;直接是window对象-->
<!--Font Awesome  一套绝佳的图标字体库和CSS框架 无需依赖JavaScript 无限缩放  完全免费 jquery-confirm里面用到 官网http://fontawesome.dashgame.com/-->
<link href="css/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link href="css/login.css" rel="stylesheet" type="text/css"/>
<link href="css/bootstrap-3.2.0/css/bootstrap.css" rel="stylesheet" type="text/css"/>
<link href="css/bootstrap-box.css" rel="stylesheet" type="text/css"/>
<link href="css/bootstrap-page.css" rel="stylesheet" type="text/css"/>
<link href="js/nice-validator/jquery.validator.css" rel="stylesheet" type="text/css"/>
<link href="js/jquery-confirm/jquery-confirm.css" rel="stylesheet" type="text/css" />
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<script type="text/javascript" src="js/jquery-confirm/jquery-confirm.js"></script>
<script src="js/jsviews.js" type="text/javascript"></script>
<script type="text/javascript" src="js/nice-validator/jquery.validator.min.js"></script>
<script type="text/javascript" src="js/nice-validator/local/zh-CN.js"></script>
<script type="text/javascript" src="js/jquery.cookie.js" ></script>
<script type="text/javascript" src="js/layer/layer.js"></script>
<script type="text/javascript" src="js/base.js" ></script>
</head>
<body>
<!--action 名称固定-->
<form action="j_spring_security_check" method="post" id="loginForm">
    <input type="hidden" name="SPRING_REQUEST_KEY" value="0"><!-- 指定字段名并将该值设置为0,为类型一登录 -->
    <div class="login-box">
        <p class="login-title">e孝道管理系统</p>
        <div class="login-line"></div>
        <div class="login-input-div login_magin">
            <input class="user_bg" type="text" placeHolder="账号" id="adminName" name="j_username"
                   data-rule="账号: required"/>
        </div>
        <div class="login-input-div">
            <input class="lock_bg" type="password" placeHolder="密码" id="adminPassword" name="j_password"
                   data-rule="密码: required"/>
        </div>
        <div class="login-input-div" style="margin-top:15px;color:#000;">
            <p for="remember">记住密码&nbsp;<input type="checkbox"  name="_spring_security_remember_me" id="remember"></p>
        </div>
        <div style="position:absolute;left:145px;color:red;" id="errorMessage"></div>
        <div class="login-input-div fn-center">
            <input type="button" value="登录" onclick="saveUserInfo()" style="margin-left:-24px;"/>
        </div>
        <!--todo  密码错误次数大于等于3次,增加验证码-->
    </div>
</form>
<Script>
    //保存用户信息
    function saveUserInfo() {
        if ($("input[type='checkbox']").is(":checked")) {
            var userName = $("#adminName").val();
            var passWord = $("#adminPassword").val();
            $.cookie("remember", "true", {expires: 7}); // 存储一个带7天期限的 cookie
            $.cookie("userName", userName, {expires: 7}); // 存储一个带7天期限的 cookie
            $.cookie("passWord", passWord, {expires: 7}); // 存储一个带7天期限的 cookie
        }
        else {
            $.cookie("remember", "false", {expires: -1});
            $.cookie("userName", '', {expires: -1});
            $.cookie("passWord", '', {expires: -1});
        }
        $("#loginForm").submit();
        myLoading();
    }
    $(function () {
        if (window.parent != window) {
            window.parent.location.reload();
        }
        document.onkeydown = function (evt) {
            var evt = window.event ? window.event : evt;
            if (evt.keyCode == 13) {
                saveUserInfo();
            }
        };
        var error = getUrlParam("login_error");
        console.log(error);
        if (typeof(error) != "undefined" && error != null) {
            $("#errorMessage").html("用户名或密码错误");
            layer.closeAll();
        }
        if ($.cookie("remember") == "true") {
            $("#remember").attr("checked", true);
            $("#adminName").val($.cookie("userName"));
            $("#adminPassword").val($.cookie("passWord"));
        }
    });
</Script>
<!-- /container -->
</body>
</html>